const path = require("path")
const HtmlWebpackPlugin = require('html-webpack-plugin')
const { VueLoaderPlugin } = require('vue-loader')
module.exports = {
    devServer: {
        port: 3000, // 端口号
       
      },
    entry: "./src/main.js", // 入口
    output: { 
        path: path.join(__dirname, "dist"), // 出口路径
        filename: "bundle.js" // 出口文件名
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: './post/index.html' // 以此为基准生成打包后html文件
        }),
        
        new VueLoaderPlugin()
    ],
    module: {
        rules: [
            
          {
              test: /\.less$/,
              // 使用less-loader, 让webpack处理less文件, 内置还会用less翻译less代码成css内容
              use: [ "style-loader", "css-loader", 'less-loader']
            },
            {
                test: /\.css$/,
                use:["style-loader","css-loader"]
            },
            {
                test: /\.(png|jpg|gif|jpeg)$/,
                type:'asset'
            },
            {
                test: /\.(eot|svg|ttf|woff|woff2)$/,
                type: 'asset/resource',
                generator: {
                filename:'font/[name].[hash:6][ext]'
            }
            },
            {
                test: /\.vue$/,
                loader:'vue-loader'
            },
        ],
      }
}